﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMN.BLL;
using CMN.Common;
using CMN.Entity;
using CMN.Models.Interfaces;
namespace CMN.Models
{
    /// <summary>
    /// 采集列表Service
    /// </summary>
    public class Extend_CollectLinkInfoService: IDataService<Extend_CollectLinkInfoEntity>
    {
        /// <summary>
        /// 新增采集列表
        /// </summary>
        /// <param name="Extend_CollectLinkInfoEntity"></param>
        /// <returns>bool</returns>
        public string Insert(Extend_CollectLinkInfoEntity extend_collectlinkinfoEntity)
        {
            extend_collectlinkinfoEntity.DataTable_Action = DataTableAction.Insert;
            Extend_CollectLinkInfo bll = new Extend_CollectLinkInfo();
            if (bll.InsertUpdateDelete(extend_collectlinkinfoEntity) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }
        }

        /// <summary>
        /// 返回采集列表查询列表
        /// </summary>
        /// <param name="qp"></param>
        /// <param name="count">查询总个数</param>
        /// <returns>List</returns>
        public List<Extend_CollectLinkInfoEntity> List(QueryParam qp,out int count)
        {
            Extend_CollectLinkInfo bll = new Extend_CollectLinkInfo();
            return bll.List(qp, out count);
        }

        /// <summary>
        /// 更新采集列表
        /// </summary>
        /// <param name="Extend_CollectLinkInfo"></param>
        /// <returns>bool</returns>
        public string Update(Extend_CollectLinkInfoEntity extend_collectlinkinfoEntity)
        {
            extend_collectlinkinfoEntity.DataTable_Action = DataTableAction.Update;
            Extend_CollectLinkInfo bll = new Extend_CollectLinkInfo();
            if (bll.InsertUpdateDelete(extend_collectlinkinfoEntity) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }
        }

        /// <summary>
        /// 删除采集列表
        /// </summary>
        /// <param name="Extend_CollectLinkInfo"></param>
        /// <returns>bool</returns>
        public string Delete(Extend_CollectLinkInfoEntity extend_collectlinkinfoEntity)
        {
            extend_collectlinkinfoEntity.DataTable_Action = DataTableAction.Delete;
            Extend_CollectLinkInfo bll = new Extend_CollectLinkInfo();
            if (bll.InsertUpdateDelete(extend_collectlinkinfoEntity) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }
        }

        /// <summary>
        /// 批量删采集列表
        /// </summary>
        /// <param name="idList">删除id列表  2_8_9_45</param>
        /// <returns>bool</returns>
        public string DeleteList(string idList)
        {
            string[] list =Utils.SplitString(idList,"_");
            string strDel=Utils.ArrayToString(list,",",false);
            Extend_CollectLinkInfo bll = new Extend_CollectLinkInfo();
            if (bll.DelList(strDel) > 0)
            {
                return "";
            }
            else
            {
                return "失败";
            }

        }

        /// <summary>
        /// 返回单个采集列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Extend_CollectLinkInfoEntity</returns>
        public Extend_CollectLinkInfoEntity Look(int id)
        {
            Extend_CollectLinkInfo bll = new Extend_CollectLinkInfo();
            return bll.Disp(id);
        }
    }
}
